package it.infodea.tapestrydea.filter.demodea;

import java.util.Collections;
import java.util.Set;

import org.apache.tapestry5.ioc.def.ContributionDef;
import org.apache.tapestry5.ioc.def.DecoratorDef;
import org.apache.tapestry5.ioc.def.ModuleDef;
import org.apache.tapestry5.ioc.def.ServiceDef;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;

public class FakeModuleDef implements ModuleDef {

	private ServiceDef fakeServiceDef;
	private String fakeServiceId;
	private Set<String> serviceIds;
	
	public FakeModuleDef(){
		fakeServiceDef = new FakeServiceDef();
		fakeServiceId = fakeServiceDef.getServiceId();
		serviceIds = CollectionFactory.newSet(fakeServiceId);
	}
	
	/**
	 * Returns null.
	 */
	public Class getBuilderClass() {
		return null;
	}

	/**
	 * Returns the configured set.
	 */
	public Set<ContributionDef> getContributionDefs() {
		return Collections.emptySet();
	}

	/**
	 * Returns an empty set.
	 */
	public Set<DecoratorDef> getDecoratorDefs() {
		return Collections.emptySet();
	}

	/**
	 * Returns "SyntheticModule".
	 */
	public String getLoggerName() {
		return "FakeModuleForDemodea";
	}

	/**
	 * Returns null.
	 */
	public ServiceDef getServiceDef(String serviceId) {
		if(fakeServiceId.equals(serviceId)) {
			return fakeServiceDef;
		}
		return null;
	}

	/**
	 * Returns an empty set.
	 */
	public Set<String> getServiceIds() {
		return serviceIds;
	}
}